Ext.chart.Chart.CHART_URL = 'ext3.4/resources/charts.swf';
Ext.onReady(function(){
	var rt = [];
	var columns = [];
	rt.push({name: 'month'});
	
	var a = 0x2345a5;
	Ext.each(ownUnitStr,function(obj){
				rt.push({name:obj.ownUnitName,type:'int'});
				a +=0xa678;
				columns.push({type:'line',displayName:obj.ownUnitName,yField:obj.ownUnitName,style:{size: 7,color: a}});
			});	
	

	var store = new Ext.data.Store({
	    url:'dev/getDevMonthRunInfo.action',
	    reader: new Ext.data.JsonReader({}, rt)
	});
	store.load();
	
	
    var panel = new Ext.Panel({
        title: '公司设备月份工作时长累计图',
        width:500,
        height:300,
        layout:'fit',
        tbar : ['当前年份：',{
			xtype:'combo',
			store:new Ext.data.JsonStore({
						     	fields: ['year', 'value'],
						        data: [{
						            year: '2012',
						            value: 2012
						        },{
						            year: '2013',
						            value: 2013
						        }]
						   }),
			editable :false,
			mode: 'local',
			displayField:'year',
			valueField:'value',
			triggerAction :'all',
            name:"currentYearChoise",
            id:"currentYearChoise",
            value:2013,
            listeners:{
            	select:function(v){
            		store.load({
            			params:{
            				year:v.value
            			}
            		});
            	}
            }
		}],
        items:{
            xtype: 'linechart',
            store: store,
            xField: 'month',
     		//添加线条的说明
 		 	chartStyle: {
                   padding: 10,
                   animationEnabled: true,   
                   legend:{   //series显示在哪里  右边
                  		display: "bottom"
                   },
                   //添加竖形线条
                   xAxis: {
                           color: 0x69aBc8,
                           majorTicks: {color: 0x69aBc8, length: 4},
                           minorTicks: {color: 0x69aBc8, length: 2},
                           majorGridLines: {size: 1, color: 0xeeeeee}
                           },
                   yAxis: {
                           color: 0x69aBc8,
                           majorTicks: {color: 0x69aBc8, length: 4},
                           minorTicks: {color: 0x69aBc8, length: 2},
                           majorGridLines: {size: 1, color: 0xdfe8f6}
                           }
                   },
            series: columns   
        }
    });
    
    new Ext.Viewport({
    	layout:'fit',
    	items:[panel]
    });
});

